<?php
switch($type){
case 'discount':
?>
<div class="clear"></div>
<div class="control-group box">
    <label class="control-label">{$Think.lang.ayj_form_ele_discount}
    <span class="required">*</span></label>
    <div class="controls">
        <input type="text" name="attr[discount]" data-required="1" 
         class="span6 m-wrap" value="{$attr[discount]}" placeholder="{$Think.lang.ayj_form_ele_discount_tip}"/>
    </div>
</div>
<?php
break;
case 'cash':
?>
<div class="clear"></div>
<div class="control-group box">
    <label class="control-label">{$Think.lang.ayj_form_ele_cash}
    <span class="required">*</span></label>
    <div class="controls">
        <input type="text" name="attr[cash]" data-required="1" 
         class="span6 m-wrap" value="{$attr[cash]}" placeholder="{$Think.lang.ayj_form_ele_cash_tip}"/>
    </div>
</div>
<?php
break;
case 'fullcut':
?>
<div class="clear"></div>
<div class="control-group box">
    <label class="control-label">{$Think.lang.ayj_form_ele_fullcut}
    <span class="required">*</span></label>
    <div class="controls">
        <a id="addFullCut" class="btn blue"><i class="icon-plus"></i>新增</a>
        <div class="clear" style="height:10px;"></div>
        
        <?php
        	if(empty($attr[fullcut])) {
        ?>
       		<div class="FullCut">
                满：<input style="width:80px;" type="text" name="attr[fullcut][full][]" data-required="1" 
                 class="span6 m-wrap" />
                
                减：<input style="width:80px;" type="text" name="attr[fullcut][cut][]" data-required="1" 
                 class="span6 m-wrap" />
                 <div class="clear" style="height:5px;"></div>
            </div>
        <?php
        	} else {
        ?>
         <volist name="attr[fullcut][full]" id="vo" key="k" >
            <div class="FullCut">
                满：<input style="width:80px;" type="text" name="attr[fullcut][full][]" data-required="1" 
                 class="span6 m-wrap" value="{$attr[fullcut][full][$k-1]}" />
                
                减：<input style="width:80px;" type="text" name="attr[fullcut][cut][]" data-required="1" 
                 class="span6 m-wrap" value="{$attr[fullcut][cut][$k-1]}" />
                 <div class="clear" style="height:5px;"></div>
            </div>
         </volist>
        <?php
        	}
        ?>
         
    </div>
</div>
<?php
break;
case 'fullsend':
?>
<div class="clear"></div>
<div class="control-group box">
    <label class="control-label">{$Think.lang.ayj_form_ele_fullsend}
    <span class="required">*</span></label>
    <div class="controls">
        <a id="addFullSend" class="btn blue"><i class="icon-plus"></i>新增</a>
        <div class="clear" style="height:10px;"></div>
        
        <?php
        	if(empty($attr[fullsend])) {
        ?>
        	<div class="FullSend">
                满：<input style="width:80px;" type="text" name="attr[fullsend][full][]" data-required="1" 
                 class="span6 m-wrap" />
                
                送：<input style="width:80px;" type="text" name="attr[fullsend][send][]" data-required="1" 
                 class="span6 m-wrap" />
                 <div class="clear" style="height:5px;"></div>
         	 </div>
		 <?php
         	} else {
         ?>
         <volist name="attr[fullsend][full]" id="vo" key="k" >
            <div class="FullSend">
                满：<input style="width:80px;" type="text" name="attr[fullsend][full][]" value="{$attr[fullsend][full][$k-1]}" data-required="1" 
                 class="span6 m-wrap" />
                
                送：<input style="width:80px;" type="text" name="attr[fullsend][send][]" value="{$attr[fullsend][send][$k-1]}" data-required="1" 
                 class="span6 m-wrap" />
                 <div class="clear" style="height:5px;"></div>
         	 </div>
         </volist>
         <?php
         	}
         ?>

    </div>
</div>
<?php
break;
case 'fulldiscount':
?>
<div class="clear"></div>
<div class="control-group box">
    <label class="control-label">{$Think.lang.ayj_form_ele_fulldiscount}
    <span class="required">*</span></label>
    <div class="controls">
        <a id="addFullDiscount" class="btn blue"><i class="icon-plus"></i>新增</a>
        <div class="clear" style="height:10px;"></div>
        
        <?php
        	if(empty($attr[fulldiscount])) {
        ?>
        <div class="FullDiscount">
            满：<input style="width:80px;" type="text" name="attr[fulldiscount][full][]" data-required="1" 
             class="span6 m-wrap" />
             
            折：<input style="width:80px;" type="text" name="attr[fulldiscount][discount][]" data-required="1" 
             class="span6 m-wrap" />
             <div class="clear" style="height:5px;"></div>
         </div>
         <?php
         	} else {
         ?>
         <volist name="attr[fulldiscount][full]" id="vo" key="k" >
            <div class="FullDiscount">
            满：<input style="width:80px;" type="text" name="attr[fulldiscount][full][]" data-required="1" 
             class="span6 m-wrap" value="{$attr[fulldiscount][full][$k-1]}" />
             
            折：<input style="width:80px;" type="text" name="attr[fulldiscount][discount][]" data-required="1" 
             class="span6 m-wrap" value="{$attr[fulldiscount][discount][$k-1]}" />
             <div class="clear" style="height:5px;"></div>
             </div>
         </volist>
         <?php
         	}
         ?>
    </div>
</div>
<?php
break;
}
?>
<script language="javascript">
$('#addFullCut').on('click',function(){
	$('.FullCut:eq(0)').clone().insertAfter('.FullCut:last');
});

$('#addFullSend').on('click',function(){
	$('.FullSend:eq(0)').clone().insertAfter('.FullSend:last');
});

$('#addFullDiscount').on('click',function(){
	$('.FullDiscount:eq(0)').clone().insertAfter('.FullDiscount:last');
});
</script>